// 求两个数组的交集

let arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let arr2 = [2, 3, 221, 222, 223, 224, 225, 226, 227, 228, 229, 2]

// 取交集 两边都有的 留下
let result = [...(new Set(arr1.filter(item => arr2.includes(item))))]
console.log('交集', result)

// 取并集 两边所有加一起 去重
let result2 = [...(new Set([...arr1, ...arr2]))]
console.log("7777 ---- file: index.js:12 ---- result2---->", result2)


// 差集 = 并集 - 交集
let result3 = [...(new Set(result2.filter(item => !result.includes(item))))]
console.log("7777 ---- file: index.js:17 ---- result3---->", result3)


